<?php
function alert($flag,$data){
    echo json_encode(array('flag'=>$flag,'data'=>$data));
    exit;
}
function email($email){
    $pattern="/^([0-9A-Za-z\\-_\\.]+)@([0-9a-z]+\\.[a-z]{2,3}(\\.[a-z]{2})?)$/i";
    if(preg_match($pattern,$email)){
        return true;
    }
    return false;
}
function is_my_var($vars){
    $pattern="/^[a-zA-Z0-9]+[a-zA-Z0-9_]{3,12}$/";
    if(preg_match($pattern,$vars)){
        return true;
    }
    return false;
}
function is_url($url){  //  ((\/){1}[a-zA-Z0-9]+)+[\/]?
    $pattern="/^(http:\/\/|https:\/\/)?(www.)?([a-zA-Z0-9]+[\.]?)+[com|cn|net|top|cc]{1}/";
    if(preg_match($pattern,$url)){
        return true;
    }
    return false;
}